/**
 * SPDX-FileCopyrightText: 2023-2025 Sangfor Technologies Inc.
 * SPDX-License-Identifier: Mulan PSL v2
 */
/**
 * Created by zhb on 2020/8/31.
 */

import Validator from '../validation/validator';
import { trim } from 'src/util/format';
export default class NameValidator extends Validator {

    verify (v) {
        const REG = /^[0-9a-zA-Z\u4e00-\u9fa5][0-9a-zA-Z\u4e00-\u9fa5 _]*$/;

        v = trim(v);
       
        if (!REG.test(v)) {
            return _('该输入项只能包含中文、字母、数字、下划线或空格（下划线不能为首字符）');
        }

        return true;
    }
}
